package sql_film;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class MapTest extends Mapper<LongWritable, Movie,  NullWritable,Movie_result> {
    Movie_result v = new Movie_result();

    @Override
    protected void map(LongWritable key, Movie value, Context context) throws IOException, InterruptedException {
        String [] datas = value.toString().split(",");
        String actor = datas[1].split("主演")[0].split(":")[1];
        int num = Integer.parseInt(datas[3].substring(0,datas[3].length()-3));
        v.set(datas[0],actor,Double.parseDouble(datas[2]),num,datas[4]);
        context.write(NullWritable.get(),v);
    }
}
